package middleware

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

/**
* Author: joker
* TODO: test
* Date: 2022/8/19
* Time: 上午9:14
**/

func OptionOk() gin.HandlerFunc {
	return func(ctx *gin.Context) {
		method := ctx.Request.Method
		if method == "OPTIONS" {
			ctx.JSON(http.StatusNoContent, nil)
			ctx.Abort()
			return
		}
		ctx.Next()
	}
}
